From c3ee7283cf481a351a10dd659bb0fc63b089671e Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 27 Jun 2007 11:43:16 +0000 Subject: [PATCH] Merged from maemo-gtk: 2007-06-27 Michael Natterer Merged from maemo-gtk: * gtk/gtkmenu.c (gtk_menu_handle_scrolling): when updating the scroll arrows' state, make sure we don't overwrite the insensitive state that might have been set by the first scroll step hitting the top/bottom border of the menu. svn path=/trunk/; revision=18260 --- ChangeLog | 12 ++++++++++- gtk/gtkmenu.c | 60 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0f6efe480..25005c7079 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-06-27 Michael Natterer + + Merged from maemo-gtk: + + * gtk/gtkmenu.c (gtk_menu_handle_scrolling): when updating the + scroll arrows' state, make sure we don't overwrite the insensitive + state that might have been set by the first scroll step hitting + the top/bottom border of the menu. + Wed Jun 27 13:27:21 2007 Tim Janik * gtk/gtkradiobutton.[hc]: applied patch to improve variable names, @@ -5,7 +14,8 @@ Wed Jun 27 13:27:21 2007 Tim Janik Wed Jun 27 11:57:41 2007 Tim Janik - * gtk/gtkstatusicon.c (gtk_status_icon_position_menu): fixed push_in description. + * gtk/gtkstatusicon.c (gtk_status_icon_position_menu): fixed + push_in description. 2007-06-27 Johan Dahlin diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 242488960b..66fd3108df 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -3273,8 +3273,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu, if (priv->upper_arrow_state != GTK_STATE_INSENSITIVE) { - gboolean arrow_pressed = FALSE; - GtkStateType arrow_state = GTK_STATE_NORMAL; + gboolean arrow_pressed = FALSE; if (menu->upper_arrow_visible && !menu->tearoff_active) { @@ -3342,17 +3341,26 @@ gtk_menu_handle_scrolling (GtkMenu *menu, } } - if (arrow_pressed) - arrow_state = GTK_STATE_ACTIVE; - else if (menu->upper_arrow_prelight) - arrow_state = GTK_STATE_PRELIGHT; - - if (arrow_state != priv->upper_arrow_state) + /* gtk_menu_start_scrolling() might have hit the top of the + * menu, so check if the button isn't insensitive before + * changing it to something else. + */ + if (priv->upper_arrow_state != GTK_STATE_INSENSITIVE) { - priv->upper_arrow_state = arrow_state; + GtkStateType arrow_state = GTK_STATE_NORMAL; + + if (arrow_pressed) + arrow_state = GTK_STATE_ACTIVE; + else if (menu->upper_arrow_prelight) + arrow_state = GTK_STATE_PRELIGHT; - gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, - &rect, FALSE); + if (arrow_state != priv->upper_arrow_state) + { + priv->upper_arrow_state = arrow_state; + + gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, + &rect, FALSE); + } } } @@ -3373,8 +3381,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu, if (priv->lower_arrow_state != GTK_STATE_INSENSITIVE) { - gboolean arrow_pressed = FALSE; - GtkStateType arrow_state = GTK_STATE_NORMAL; + gboolean arrow_pressed = FALSE; if (menu->lower_arrow_visible && !menu->tearoff_active) { @@ -3442,17 +3449,26 @@ gtk_menu_handle_scrolling (GtkMenu *menu, } } - if (arrow_pressed) - arrow_state = GTK_STATE_ACTIVE; - else if (menu->lower_arrow_prelight) - arrow_state = GTK_STATE_PRELIGHT; - - if (arrow_state != priv->lower_arrow_state) + /* gtk_menu_start_scrolling() might have hit the bottom of the + * menu, so check if the button isn't insensitive before + * changing it to something else. + */ + if (priv->lower_arrow_state != GTK_STATE_INSENSITIVE) { - priv->lower_arrow_state = arrow_state; + GtkStateType arrow_state = GTK_STATE_NORMAL; + + if (arrow_pressed) + arrow_state = GTK_STATE_ACTIVE; + else if (menu->lower_arrow_prelight) + arrow_state = GTK_STATE_PRELIGHT; - gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, - &rect, FALSE); + if (arrow_state != priv->lower_arrow_state) + { + priv->lower_arrow_state = arrow_state; + + gdk_window_invalidate_rect (GTK_WIDGET (menu)->window, + &rect, FALSE); + } } } } -- 2.30.2